/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package DAO;

import DTO.LoaiTau;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author Tu Nguyen
 */
public class LoaiTauDAO {
    public static LoaiTau Get(int Id)
    {
        try
        {
            Connection con = DBConnect.Connect();
            String sql = String.format("Select * From loai_tau Where id=%s ",Id);
            PreparedStatement ps = con.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            
            LoaiTau gh = new LoaiTau();
            while(rs.next())
            {
                gh.Id = rs.getInt("id");
                gh.Tang_Gia = rs.getInt("tang_gia");
            }
            return gh;
        }
        catch (Exception ex)
        {
        }
        return null;
    }
}
